package com.xtx.mapper;

import com.xtx.entity.Categories;
import com.xtx.entity.CategoryChildren;
import com.xtx.entity.CategorySubParent;
import com.xtx.entity.ChildrenGoods;
import com.xtx.vo.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;


import java.util.List;

@Mapper
public interface CategoryMapper {

    @Select("select * from category")
    List<CategoryHeaderVo> getCategoryApi();

    List<CategoryChildren> getCategoryChildrenById(Integer id); // 根据分类ID查询子分类列表

    @Select("select * from category where id = #{id}")
    List<CategoryVo> getCategoryById(Integer id);
    @Select("select * from category_children where categoryId = #{id}")
    List<CategoryChildren> getCategoryChildrenId(Integer id);
    @Select("select name, `desc`, price, picture, goodsId from children_goods where categoryId = #{id}")
    List<ChildrenGoods> getCategoryGoods(Integer id);
    @Select("select id,name from category_children where categoryId = #{id}")
    List<CategoryGoodsVo> CategoryChildrenById(Integer id);
    @Select("select * from children_goods where categoryId = #{id}")
    List<ChildrenGoods> getCategoryGoodsSubById(Integer id);
    @Select("select id,name from category_children where id = #{id}")
    List<CategoryGoodsSubVO> CategoryChildrenSubById(Integer id);

    CategorySubParent getCategorySubParentById(Integer id);

    @Select("select categoryId from children_goods where id = #{id}")
    Integer getChildrenGoods(Integer id);

    List<Categories> getCategoriesById(Integer categoryId);
}
